package store.lunangangster.engine.impl.interceptor;

import store.lunangangster.engine.impl.db.DbSqlSession;

public class TransactionSessionCloseListener implements SessionListener {

  protected DbSqlSession dbSqlSession;

  public TransactionSessionCloseListener(CommandContext commandContext) {
    dbSqlSession = commandContext.getDbSqlSession();
  }

  @Override
  public void beforeFlush() {

  }

  @Override
  public void afterFlush() {
    // 事务提交
    dbSqlSession.getSqlSession().commit();
  }

  @Override
  public void beforeClose() {

  }

  @Override
  public void afterClose() {

  }
}
